package com.example.frn.controller;

import com.example.frn.util.MinioUtil;
import com.example.frn.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 提供文件上传(预览，下载，删除)接口
 */
@RestController
@RequestMapping("/api/v1/file")
public class FileController {
    @Autowired
    MinioUtil minioUtil;
    @PostMapping("upload")
    public R upload(@RequestParam MultipartFile multipartFile){
        String objName = minioUtil.upload(multipartFile);
        return R.ok(objName);
    }
}
